{include file = "styles/header.tpl"}
<div id="content" class="content">
	<h1>{if $arrResult}Edit Tooltip{else}Create Tooltip{/if}</h1>

	<form id="form" name="form" action="" target="ifrm" method="post" onsubmit="return checkFormAddTooltip();">
		<fieldset>
			<legend>Tooltip Information</legend>
			<table width="100%">
			   {if $arrResult}
			     <input type="number" size="50" name="intId" id="intId" value="0" style="display:none;"/>
			   {else}
			     <input type="number" size="50" name="intId" id="intId" value="{$intId}" style="display:none;" />
			   {/if}
			    
			    <tr>
					<td><strong>Type (Table):</strong></td>
					<td>
						<select name="strType" id="strType" onchange="strTypeChange();">
						  <option value="sales" {if  $strType == "`$country`_sales"} selected="selected" {/if}>Sales </option>
						  <option value="forecasts" {if   $strType  == "`$country`_forecasts"} selected="selected" {/if}>Forecasts </option>
						  <option value="suppliers" {if  $strType  == "`$country`_suppliers"} selected="selected" {/if}>Suppliers </option>
						</select>
						<span class="msg info">
							Type (table name) is not blank.
						</span> 
					</td>
				</tr>
				<tr>
					<td width="15%"><strong>Column:</strong></td>
					<td>
						<select name="strColumn" id="strColumn" onchange="strColumnChange();">
							{foreach from = $arrayType item=name key= key}
								<option value="{$key}" {if $strColumn == $key } selected ="selected" {/if}>&nbsp;{$key}</option>
							{/foreach}/
						</select>
						<span class="msg info">
							Column is not blank.
						</span> 
					</td>
				</tr>
				<tr>
					<td><strong>Column Header:</strong></td>
					<td>
						<textarea cols="50" rows="3" name="strNameShow" id="strNameShow">{$strNameShow}</textarea>
						<span class="msg info">
							Column header is not blank.
						</span> 
					</td>
				</tr>
				<tr>
					<td><strong>Description:</strong></td>
					<td>
						<textarea cols="50" rows="3" name="strDescription" id="strDescription">{$strDescription}</textarea>
						<span class="msg info">
							Description is not blank.
						</span> 
					</td>
				</tr>
				
				<tr>
					<td><strong>Data validate:</strong></td>
					<td>
						<textarea cols="50" rows="3" name="strDataValidate" id="strDataValidate">{$strDataValidate}</textarea>
				   <div><em>Seperate by <strong>(;)</strong></em></div>
				   </td>
				</tr>
				
				<tr>
					<td>&nbsp;</td>
					<td>
						<input type="submit" value="{if $arrResult}Update Tooltip{else}Create Tooltip{/if}" class="bt" />
					</td>
				</tr>
			</table>
		</fieldset>
	</form>
	<iframe name="ifrm" id="ifrm" style="display:none"></iframe>
</div>
{literal}
<script type="text/javascript">   
 
	function checkFormAddTooltip()
	{
		hide_all_error();
		var iCheck	= 0;
		var eFocus	= '';
		
		var id		= 'strColumn';
		var e		= $('#'+id);
		if( !e.val() )
		{
			iCheck 	= 1;
			eFocus	= eFocus ? eFocus : e;
			show_error(id, 'null');
		}
		
		var id		= 'strDescription';
		var e		= $('#'+id);
		if( !e.val() )
		{
			iCheck 	= 1;
			eFocus	= eFocus ? eFocus : e;
			show_error(id, 'null');
		}
		
		var id		= 'strType';
		var e		= $('#'+id);
		if( e.val()=='0' || e.val()==0)
		{
			iCheck 	= 1;
			eFocus	= eFocus ? eFocus : e;
			show_error(id, 'null');
		}
	
		showWaiting();
		return true;
	}
	
	function submit_done()
	{
		window.location.href =  HOST_ADMIN + '/tooltip/?strType=' +$("#strType").val();
	}

	function strTypeChange(){
	   window.location.href = HOST_ADMIN  + '/tooltip/add/?strType=' + $("#strType").val();
	}

	function strColumnChange(){
	   window.location.href = HOST_ADMIN  + '/tooltip/add/?strType=' + $("#strType").val() + "&strColumn=" + $("#strColumn").val();
	}

</script>
{/literal}
{include file = "styles/footer.tpl"}